<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
      *{
        margin: 0;
        padding: 0;
      }
      .title{
        width: 100%;
        height: 30px;
        background-color: green;
        color:white;
        line-height: 30px;
        padding-left: 100px;
      }
      .box{
        width: 300px;
        height: 300px;
        border: 2px solid #ccc;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%,-50%);
        
      }
      .line{
        width: 100%;
        height: 30px;
        background-color: cornflowerblue;
        line-height: 30px;
      }
      .drop{
        padding-left: 10px;
        cursor: move;
      }
      .close{
        float: right;
        padding-right: 10px;
        cursor: pointer;
      }
  </style>
</head>
<body>
  <div class="title">
    <strong>注册信息</strong>
  </div>
  <div class="box">
    <div class="line">
      <span class="drop">注册信息 可以拖拽</span>
      <span class="close">关闭</span>
    </div>
  </div>
  <script>
    var box = document.querySelector('.box');
    var close = document.querySelector('.close');
    box.onmousedown = function(e){
      e = e || window.event
      var mouse_x = e.clientX - this.offsetLeft;
      var mouse_y = e.clientY - this.offsetTop;
      document.onmousemove = function(e){
        e = e || window.event
        box.style.left = e.pageX - mouse_x + 'px';
        box.style.top = e.pageY - mouse_y + 'px';
      };
    };
    box.onmouseup = function(){
      document.onmousemove = null;
    };
    close.onclick = function(){
      box.style.display = 'none';
    };
  </script>
</body>
</html>



































































































































































































































































































































































































































































































































